﻿using AgencyManagerSystem.Model;
using System.Collections.Generic;
using System.Linq;

namespace AgencyManagerSystem.DataFetcher
{
    public class PuOrderFetcher : BaseFetcher<PuOrderModel>
    {
        public PuOrderFetcher() : base()
        {

        }
        public PuOrderModel GetByCode(string code)
        {
            Condition[] conditions = new Condition[] { new Condition() { Key = "Code", Op = "=", Value = code } };
            var list = List(conditions);
            if (list.Count > 0)
                return list.First();
            else
                return null;
        }
        public IList<PuOrderModel> ListBySupplier(int suppiler, int post, int size,out int cnt)
        {
            Condition[] conditions = new Condition[] { new Condition() { Key = "Suppiler", Op = "=", Value = suppiler } };
            var list = List(conditions, post, size,out cnt);
            return list;
        }
        public IList<PuOrderModel> ListBySupplier(int suppiler)
        {
            Condition[] conditions = new Condition[] { new Condition() { Key = "Suppiler", Op = "=", Value = suppiler } };
            var list = List(conditions);
            return list;
        }
    }
}

